#include <stdio.h>
//冒泡排序
void sort(int* arr, int size);
int main()
{
//    int arr[] = {9,8,7,6,5,4,3,2,1,0};
    int arr[] = {1,2,4,3,5,6,7,8};
    int sz = sizeof(arr) / sizeof(arr[0]);
    sort(arr, sz);
    int i = 0;
    for(i= 0; i<sz; i++)
    {
        printf("%d ",arr[i]);
    }
    return 0;
}

void sort(int* arr, int size)
{
    int i = 0;
    int flag = 0;
    for(i=0; i < size -1; i++)
    {
        int j = 0;
        for(j=0; j<size-1-i; j++)
        {
            if(arr[j] > arr[j+1])
            {
                int temp = arr[j];
                arr[j] = arr[j+1];
                arr[j+1] = temp;
                flag = 1;
            }
        }
        if(!flag)
            break;
    }
}